import 'package:dio/dio.dart';
import 'package:dk_flutter_base/dk_ui.dart';
import 'package:dk_flutter_base/src/core/network/http_call_back_default.dart';
import 'package:dk_flutter_base/src/ui/widget/dk_divider_line.dart';
import 'package:dk_flutter_base/src/core/ui/http_error_widget.dart';
import 'package:dk_flutter_base/src/core/ui/widget_error.dart';
import 'package:dk_flutter_base/src/core/util/toast_util.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:oktoast/oktoast.dart';
import 'page/app_bar.dart';
import 'page/app_bottom_sheet_dialog.dart';
import 'page/app_navigation_bottom.dart';
import 'page/app_pop.dart';
import 'page/app_tab_bottom.dart';
import 'page/app_test_notifiy_item_change.dart';
import 'page/app_tip_dialog.dart';
import 'page/test_base_64.dart';
import 'page/test_inherit.dart';
import 'page/test_material.dart';
import 'page/test_text_field.dart';
import 'page/test_toast.dart';
import 'page/test_scale_text.dart';
import 'page/test_trapezium.dart';
import 'page/test_uri.dart';
import 'picker/test_picker.dart';
import 'refresh_list/refresh_page.dart';
import 'package:dk_flutter_base/src/ui/widget/dk_refresh_accessory.dart';


void main() {
  DkEasyRefreshController easyRefreshController = DkEasyRefreshController();
  // 条目总数
  int _count = 8;
  runApp(MaterialApp(
    title: "测试",
    home: Scaffold(
      appBar: AppBar(
        title: Text("刷新"),
      ),
      body: Container(
        color: Colors.orange,
        child: Column(
          children: <Widget>[
            Container(
              height: 100,
              child: FlatButton(
                child: Text("点击",),
                onPressed: () {
                  easyRefreshController.callRefresh();
                },
              ),
              color: Colors.green,
            ),
            Container(
              height: 400,
              child: DkRefreshListWidget.custom(
                  onRefresh: () async{
                    print("123456");
                  },
                  onLoad: () async {
                    print("678910");
                  },
                  slivers: <Widget>[
                    SliverList(
                      delegate: SliverChildBuilderDelegate(
                            (context, index) {
                          return Container(
                            color: Colors.green,
                            height: 100,
                            child: Text("1111"),
                          );
                        },
                        childCount: _count,
                      ),
                    ),
                  ]),
            ),
          ],
        ),
      ),
    ),
  ));
}

/*
void main() {
  DkEasyRefreshController easyRefreshController = DkEasyRefreshController();
  // 条目总数
  int _count = 8;
  runApp(MaterialApp(
    title: "测试",
    home: Scaffold(
      appBar: AppBar(
        title: Text("刷新"),
      ),
      body: Container(
        color: Colors.orange,
        child: Column(
          children: <Widget>[
            Container(
              height: 100,
              child: FlatButton(
                child: Text("点击",),
                onPressed: () {
                  easyRefreshController.callRefresh();
                },
              ),
              color: Colors.green,
            ),
            Container(
              height: 400,
              child: DkEasyRefreshWidget(
                refreshBean: refreshBean,
                slivers: <Widget>[
                  SliverList(
                    delegate: SliverChildBuilderDelegate(
                          (context, index) {
                        return Container(
                          color: Colors.green,
                          height: 100,
                          child: Text("1111"),
                        );
                      },
                      childCount: _count,
                    ),
                  ),
                ],
              ),
            ),
          ],
        ),
      ),
    ),
  ));
}
*/
/*
//  runApp(AppBarWidget());
//  runApp(NavigationBottomApp());
//  runApp(TabBottomApp());
//  runApp(
//    OKToast(
//      child: MaterialApp(
//        title: 'Flutter Demo',
//        theme: ThemeData(
//            primaryColor: Colors.white,
//            backgroundColor: Colors.white,
//            accentColor: Color(0xFF3DBCC6),
//            primaryColorBrightness: Brightness.light,
//            primaryTextTheme: TextTheme(
//              //设置Material的默认字体样式
//              title: TextStyle(color: Color(0xff333333), fontSize: 17.0),
//            ),
//            primaryIconTheme: IconThemeData(
//              color: Color(0xff333333),
//              size: 20.0,
//            ),
//            appBarTheme: AppBarTheme(
//                textTheme: TextTheme(
//                  title: TextStyle(color: Color(0xff333333), fontSize: 17),
//                  body1: TextStyle(color: Color(0xff333333), fontSize: 17),
//                ),
//                elevation: 0.5,
//                actionsIconTheme: IconThemeData(size: 16))),
//        home: Scaffold(
////      body: TestTipDialogWidget(),
////      body: Divider(
////        height: 5,
////        color: Colors.red,
////        indent: 5,
////      ),
////      body: DkDivider(
////          DividerOption.vertical(indentStart: 10,width: 50,color: Colors.blue,indentEnd: 60)
////      ),
////      body: TestPickerWidget(),
////      body: TestPopWidget(),
////          body: TestToast(),
////          body: DkErrorWidget(ErrorOption.pageError(title:"1")),
////          body: HttpErrorWidget(DefaultHttpError(1, "11111"), DioError(), false),
////          body: TestTextFieldPage(),
////          body: RefreshPage(),
////          body: TestUri(),
////          body: TestBase64(),
////          body: MaterialShadow(),
//          body: TestInherit(),
//        ),
//      ),
//    ),
//  );
//}
*/